from django.db import models

class Player(models.Model):
    email = models.EmailField(unique=True)
    name = models.CharField(max_length=255)
    username = models.SlugField(primary_key=True)

class World(models.Model):
    players = models.ManyToManyField(Player, related_name='worlds')

class Territory(models.Model):
    world = models.ForeignKey(World, related_name='territories')
    owner = models.ForeignKey(Player)
    name = models.CharField(max_length=64)
    abbreviation = models.SlugField (max_length=3)

    class Meta(object):
        unique_together = (("name", "world"),)


